﻿using System;

namespace Results.ViewModels
{
    /// <summary>
    /// A specific group, like "Men 14-16"
    /// </summary>
    public class GroupViewModel : ViewModelBase
    {
        /// <summary>
        /// Command to invoke when this group is selected
        /// </summary>
        public RelayCommand GroupSelected { get; private set; }

        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="group">A specific group, like "Men 14-16"</param>
        /// <param name="notifySelection">Methods to call if the user selects something</param>
        public GroupViewModel(String group, INotifySelection notifySelection)
        {
            Group = group;
            GroupSelected = new RelayCommand(p => notifySelection.GroupSelected(group));
        }

        String _group;
        public String Group
        {
            get
            {
                return _group;
            }
            set
            {
                if (_group != value)
                {
                    _group = value;
                    Notify("Group");
                }
            }
        }

        Boolean _selected;
        public Boolean Selected
        {
            get
            {
                return _selected;
            }
            set
            {
                if (_selected != value)
                {
                    _selected = value;
                    Notify("Selected");
                }
            }
        }
    }
}
